#include<iostream>
#include<stack>
using namespace std;
const int N = 2e5 + 10;
int arr[N];
int ans[N];
int n;
stack<int>stk;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	for (int i = n - 1; i >= 0; i--) {
		while (stk.size() && arr[i] > stk.top()) {
			stk.pop();
		}
		stk.push(arr[i]);
		ans[i] = stk.size();
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << " ";
	}
	return 0;
}